  .text
  .globl main
main:
  addi  $a0, $zero, 4
  addi  $sp, $sp, -4
  sw    $ra, 0($sp)
  jal   fact
# add   $v1, $zero, $v0
# Because later we'll need to store use $v0 to syscall 10(exit)
  move  $v1, $v0
  lw    $ra, 0($sp)
  jr    $ra

fact:
  addi  $sp, $sp, -8
  sw    $a0, 0($sp)
  sw    $ra, 4($sp)
  slti  $t0, $a0, 1
  beq   $t0, $zero, L1
  addi  $v0, $zero, 1
  addi  $sp, $sp, 8
  jr    $ra
L1:
  addi  $a0, $a0, -1
  jal   fact
  lw    $a0, 0($sp)
  lw    $ra, 4($sp)
  addi  $sp, $sp, 8
  mul   $v0, $a0, $v0
  jr    $ra
